/* ========================================
   VARIABLES CSS
   ======================================== */
:root {
    --parchment: #f4e9d8;
    --parchment-dark: #d4c4a8;
    --ink: #2c2416;
    --gold: #c9a961;
    --gold-dark: #9d7d3a;
    --burgundy: #6b2737;
    --forest: #3a5a40;
}

/* Variables pour le thème Windress (Hiver/Neige) */
body.theme-windress {
    --parchment: #e8f4f8;
    --parchment-dark: #c8d8e4;
    --ink: #1a3a52;
    --gold: #6b9fc9;
    --gold-dark: #4a7ba3;
    --burgundy: #2d4a5e;
    --forest: #3a5a6a;
}

/* Variables pour le thème Pylorianne (Feu/Lave) */
body.theme-pylorianne {
    --parchment: #ffe8d6;
    --parchment-dark: #e8c4a8;
    --ink: #4a1f0f;
    --gold: #ff6b35;
    --gold-dark: #cc5529;
    --burgundy: #8b2e16;
    --forest: #6a3820;
}

/* Variables pour le thème Arzass (Nocturne/Mystique) */
body.theme-arzass {
    --parchment: #1a1625;
    --parchment-dark: #2a2438;
    --ink: #e8e4f3;
    --gold: #9d7bd8;
    --gold-dark: #7859b3;
    --burgundy: #b794f6;
    --forest: #4a3f5c;
}

/* Variables pour le thème Markarane (Désert - Tempête de sable) */
body.theme-markarane {
    --parchment: #d4a154;
    --parchment-dark: #b8853a;
    --ink: #3a2a1a;
    --gold: #c9a961;
    --gold-dark: #8b5a2b;
    --burgundy: #6b4a2a;
    --forest: #5a3a1a;
}

/* ========================================
   STYLES DE BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', serif;
    background-color: var(--parchment);
    color: var(--ink);
    min-height: 100vh;
    position: relative;
    line-height: 1.7;
    transition: background-color 0.8s ease, color 0.8s ease;
    overflow-x: hidden;
}

/* ========================================
   OVERLAY DE TEXTURE
   ======================================== */
.parchment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(44, 36, 22, 0.015) 2px,
            rgba(44, 36, 22, 0.015) 4px
        );
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   SYSTÈME D'ONGLETS DE THÈME
   ======================================== */
.theme-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(44, 36, 22, 0.05) 0%, rgba(201, 169, 97, 0.1) 100%);
    border-bottom: 3px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    backdrop-filter: blur(8px);
}

.theme-tab {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid var(--gold);
    color: var(--burgundy);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 0;
}

.theme-tab:hover {
    background: var(--gold);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(44, 36, 22, 0.2);
}

.theme-tab.active {
    background: var(--burgundy);
    color: white;
    border-color: var(--burgundy);
    box-shadow: 0 4px 12px rgba(107, 39, 55, 0.4);
}

/* ========================================
   HEADER
   ======================================== */
.header {
    text-align: center;
    padding: 60px 20px 40px;
    position: relative;
    z-index: 4;
    border-bottom: 2px solid var(--gold);
    background: linear-gradient(to bottom, var(--parchment) 0%, rgba(201, 169, 97, 0.05) 100%);
}

body.theme-windress .header,
body.theme-pylorianne .header,
body.theme-arzass .header,
body.theme-markarane .header {
    backdrop-filter: blur(5px);
}

.ornament {
    font-size: 2.5rem;
    color: var(--gold);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
}

.ornament-left {
    left: 20px;
}

.ornament-right {
    right: 20px;
}

.title-container {
    max-width: 800px;
    margin: 0 auto;
}

.main-title {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 3.5rem;
    color: var(--burgundy);
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px rgba(201, 169, 97, 0.3);
    animation: fadeInDown 1s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subtitle {
    font-family: 'Crimson Text', serif;
    font-size: 1.3rem;
    color: var(--gold-dark);
    font-style: italic;
    letter-spacing: 2px;
    animation: fadeIn 1.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   CONTAINER
   ======================================== */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 20px;
    position: relative;
    z-index: 4;
}

/* ========================================
   NAVIGATION
   ======================================== */
.navigation {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 60px;
    width: 100%;
}

.nav-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, var(--parchment-dark) 100%);
    border: 2px solid var(--gold);
    padding: 30px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.6s ease-out backwards;
    backdrop-filter: blur(3px);
}

body.theme-pylorianne .nav-item,
body.theme-windress .nav-item,
body.theme-arzass .nav-item,
body.theme-markarane .nav-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(232, 196, 168, 0.9) 100%);
}

.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.15s; }
.nav-item:nth-child(3) { animation-delay: 0.2s; }
.nav-item:nth-child(4) { animation-delay: 0.25s; }
.nav-item:nth-child(5) { animation-delay: 0.3s; }
.nav-item:nth-child(6) { animation-delay: 0.35s; }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(201, 169, 97, 0.2), transparent);
    transition: left 0.5s ease;
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(44, 36, 22, 0.15);
    border-color: var(--gold-dark);
}

.nav-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    filter: grayscale(30%);
    transition: filter 0.3s ease;
}

.nav-item:hover .nav-icon {
    filter: grayscale(0%);
}

.nav-text {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--burgundy);
}

/* ========================================
   EFFETS PAR THÈME
   ======================================== */

/* Neige sur les cases - Windress */
body.theme-windress .nav-item::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 15px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
    opacity: 1;
    transition: opacity 0.8s ease;
}

body.theme-windress .nav-item:nth-child(odd)::after {
    height: 20px;
}

body.theme-windress .nav-item:nth-child(3n)::after {
    height: 12px;
}

/* Lueur de feu sur les cases - Pylorianne */
body.theme-pylorianne .nav-item {
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.3);
}

body.theme-pylorianne .nav-item:hover {
    box-shadow: 0 0 25px rgba(255, 107, 53, 0.6);
}

body.theme-pylorianne .nav-item::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, transparent, rgba(255, 107, 53, 0.7), transparent);
    opacity: 1;
    animation: flicker 2s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Lueur mystique - Arzass */
body.theme-arzass .nav-item {
    box-shadow: 0 0 20px rgba(183, 148, 246, 0.4);
    border-color: var(--gold);
}

body.theme-arzass .nav-item:hover {
    box-shadow: 0 0 30px rgba(183, 148, 246, 0.7);
}

body.theme-arzass .nav-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(183, 148, 246, 0.1), rgba(157, 123, 216, 0.2));
    opacity: 1;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}

/* Effet sable - Markarane */
body.theme-markarane .nav-item {
    box-shadow: 0 5px 15px rgba(212, 161, 84, 0.4);
}

body.theme-markarane .nav-item:hover {
    box-shadow: 0 8px 20px rgba(212, 161, 84, 0.6);
}

body.theme-markarane .nav-item::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 20px;
    background: linear-gradient(to bottom, 
        rgba(212, 161, 84, 0.6) 0%, 
        rgba(184, 133, 58, 0.4) 50%, 
        transparent 100%);
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
    opacity: 1;
    filter: blur(2px);
}

body.theme-markarane .nav-item:nth-child(odd)::after {
    height: 25px;
}

body.theme-markarane .nav-item:nth-child(3n)::after {
    height: 15px;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    text-align: center;
    padding: 40px 20px 30px;
    position: relative;
    z-index: 4;
}

.divider {
    width: 200px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    margin: 0 auto 20px;
}

.footer p {
    font-size: 0.95rem;
    color: var(--gold-dark);
    letter-spacing: 1px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .navigation {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .theme-tabs {
        gap: 8px;
        padding: 12px 15px;
    }
    
    .theme-tab {
        font-size: 0.85rem;
        padding: 8px 15px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .ornament {
        font-size: 1.8rem;
    }

    .ornament-left {
        left: 10px;
    }

    .ornament-right {
        right: 10px;
    }

    .navigation {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .theme-tabs {
        gap: 6px;
        padding: 10px;
    }
    
    .theme-tab {
        font-size: 0.75rem;
        padding: 8px 12px;
        letter-spacing: 0.5px;
    }

    .container {
        padding: 40px 15px;
    }
}